package com.wolfman.uploadfile.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Title
 * @Description
 * @Author WolfMan
 * @Date 2021/8/23 0:37
 * @Email 2370032534@qq.com
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {

    /**
     * 标志变量，是否成功
     */
    private Boolean flag;

    /**
     * 成功返回的数据
     */
    private Object data;

    /**
     * 失败提示消息
     */
    private String message;

    /**
     * 成功返回结果
     *
     * @param data
     * @return
     */
    public static Result success(Object data,String message) {
        Result result = new Result();
        result.setFlag(true);
        result.setData(data);
        result.setMessage(message);
        return result;
    }

    /**
     * 失败返回结果
     *
     * @param message
     * @return
     */
    public static Result error(String message) {
        Result result = new Result();
        result.setFlag(false);
        result.setMessage(message);
        return result;
    }

}
